<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
class Api_Model_Friend
{
	private $user_id;
	private $friend_id;

	public function __construct($friend_row = null) {
		if(!is_null($friend_row) && $friend_row instanceof Zend_Db_Table_Row) {
			$this->user_id = $friend_row->user_id;
			$this->friend_id = $friend_row->friend_id;
		}
	}

	public function __set($name, $value) {
		switch($name) {
			case 'user_id':
				if(!is_null($this->user_id)) {
					throw new Exception('Cannot update user_id\'s id');
				}
				break;
			case 'friend_id':
				if(!is_null($this->friend_id)) {
					throw new Exception('Cannot update friend to\'s id');
				}
				break;

		}
		$this->$name = $value;
	}

	public function __get($name) {
		return $this->$name;
	}
}

